﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace WXFramework.Model
{
    /// <summary>
    /// 文本消息
    /// </summary>
    [Serializable]
    [XmlRoot("xml", Namespace = "")]
    public class RequestTextMessage : RequestMessage
    {
        public RequestTextMessage() { }

        public RequestTextMessage(XElement xml)
            : base(xml)
        {
            this.Content = xml.Element("Content").Value;
            this.MsgId = xml.Element("MsgId").Value;
        }

        public override MsgType MsgType
        {
            get { return MsgType.Text; }
        }

        [XmlIgnore]
        public string Content { get; set; }

        [XmlElement("Content")]
        public XmlCDataSection CContent
        {
            get
            {
                return doc.CreateCDataSection(Content.ToString());
            }
            set
            {
                Content = value.Value;
            }
        }

        public string MsgId { get; set; }


    }
}
//<xml>
// <ToUserName><![CDATA[toUser]]></ToUserName>
// <FromUserName><![CDATA[fromUser]]></FromUserName> 
// <CreateTime>1348831860</CreateTime>
// <MsgType><![CDATA[text]]></MsgType>
// <Content><![CDATA[this is a test]]></Content>
// <MsgId>1234567890123456</MsgId>
// </xml>